﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyPayDemo.WeiPay
{
    public class ExcuteNative : IFunction
    {
        public override void Execute()
        {
            M_Native request = new M_Native();
            request.orgId = WeiPayConfig.orgId;
            request.orgMercode = WeiPayConfig.orgMercode;
            request.orgTermno = WeiPayConfig.orgTermno;
            request.signType = WeiPayConfig.SIGN_TYPE_RSA256;

            request.orgTrace = WeiPayUtils.GetOrgTrace(WeiPayConfig.orgId);

            M_Native.Data dataBean = new M_Native.Data();

            dataBean.tradeCode = "";
            dataBean.tradeAmt = 1;

            request.data = dataBean;

            var chkStr = WeiPayUtils.GetSignData<M_Native.Data>(dataBean);
            string sign = EncryptionUtil.RSASignJavaBouncyCastle(chkStr.ToString(), WeiPayConfig.PrivateKey, "SHA256withRSA");
            request.sign = sign;

            var result = HttpPost<M_Native>(WeiPayConfig.ApiUrlNative, request);
            
        }
    }
}
